//
//  LZAboutViewController.m
//  DoctorFAQs
//
//  Created by langZai on 2017/2/13.
//  Copyright © 2017年 zjq. All rights reserved.
//

#import "LZAboutViewController.h"

@interface LZAboutViewController ()<UIScrollViewDelegate>
/** 版本号 */
@property (nonatomic, copy) NSString *versionNum;
/** scrollView */
@property (nonatomic, strong) UIScrollView *mainScrollView;

@end

@implementation LZAboutViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationItem.title = @"关于我们";
    self.view.backgroundColor = KHColorFromRGB(0xf8f8f8);
    [self getVersion];
    [self createScrollView];
}


- (void)createScrollView {
    
    if (!_mainScrollView) {
        _mainScrollView = [[UIScrollView alloc] init];
        _mainScrollView.delegate = self;
        _mainScrollView.showsVerticalScrollIndicator = NO;
        _mainScrollView.backgroundColor = KHColorFromRGB(0xffffff);
        [self.view addSubview:_mainScrollView];
        [_mainScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.sizeOffset(CGSizeMake(SCREEN_Width, SCREEN_Height - 64));
            make.top.equalTo(self.view).offset(5*ysIZE);
            make.centerX.equalTo(self.view);
        }];
        
    }
    
    
    // 图标
    UIImageView *normolImageView = [[UIImageView alloc] init];
    normolImageView.image = [UIImage imageNamed:@"iTunesArtwork@2x512"];
    [_mainScrollView addSubview:normolImageView];
    [normolImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.sizeOffset(CGSizeMake(70*xsIZE, 70*ysIZE));
        make.top.equalTo(_mainScrollView.mas_top).offset(40*ysIZE);
        make.centerX.equalTo(_mainScrollView);
    }];
    
    // 问答医生字
    UILabel *nameLabel = [[UILabel alloc] init];
    nameLabel.text = @"问答医生";
    nameLabel.font = NEWFONT(18);
    nameLabel.textColor = KHColorFromRGB(0x333333);
    [nameLabel sizeToFit];
    [_mainScrollView addSubview:nameLabel];
    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(normolImageView.mas_bottom).offset(15*ysIZE);
        make.centerX.equalTo(normolImageView);
    }];
    
    
    // 当前版本string = [NSString initWithFormat:@"%@,%@", string1, string2 ];
    UILabel *versionLabel = [[UILabel alloc] init];
    versionLabel.font = NEWFONT(13);
    versionLabel.textColor = KHColorFromRGB(0x4bb92c);
    versionLabel.textAlignment = NSTextAlignmentLeft;
    NSString *Now = @"当前版本：V";
    versionLabel.text = [NSString stringWithFormat:@"%@%@", Now,self.versionNum];
    [_mainScrollView addSubview:versionLabel];
    [versionLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(_mainScrollView);
        make.top.equalTo(nameLabel.mas_bottom).offset(10*ysIZE);
    }];
    
    
    // 介绍Label
    UILabel *introduceLabel = [[UILabel alloc] init];
    introduceLabel.numberOfLines = 0;
    introduceLabel.font = NEWFONT(16);
    introduceLabel.textColor = KHColorFromRGB(0x666666);
    introduceLabel.textAlignment = NSTextAlignmentLeft;
    introduceLabel.text = @"问答医生是提供用户与医生直接沟通，用户咨询疑难杂症的APP";
    
    [_mainScrollView addSubview:introduceLabel];
    CGFloat height = [Tools boundingRectWithSize:CGSizeMake(SCREEN_Width - 30, MAXFLOAT) Font:NEWFONT(16) Title:introduceLabel.text].height +10;
    
    [introduceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_mainScrollView).offset(15);
//        make.right.equalTo(_mainScrollView).offset(15);
        make.top.equalTo(versionLabel.mas_bottom).offset(38*ysIZE);
        make.size.sizeOffset(CGSizeMake(SCREEN_Width - 30, height));
//        make.height.offset(height*ysIZE);
//        make.right.equalTo(_mainScrollView.mas_right).offset(-15*xsIZE);
    }];
    _mainScrollView.contentSize = CGSizeMake(0, height + 205);
    
}

// 获取app版本
- (NSString *)getVersion {
    NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
    // app版本
    NSString *app_Version = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
    self.versionNum = app_Version;
    return self.versionNum;
    
}




@end
